package org.hhchat.others.didi;

import java.util.Scanner;

/**
 * Created this one by HMH on 2017/8/26.
 */
public class exam02 {
    public static int getKthElemIndex(int[] a,int l,int h,int k){

        if(l<=h && k>0 && k<=a.length){
            int[] range = q3partition(a, l, h);
            if(k-1<range[0]){
                return getKthElemIndex(a, l, range[0] - 1, k);
            }
            else if(k-1>range[1]){
                return getKthElemIndex(a, range[1]+1, h, k);
            }
            else{
                return k - 1;
            }
        }
        return -1;
    }

    static  int[] q3partition(int[] a, int l, int h){
        int key=a[l];
        int i=l;
        while(i<=h){
            if (a[i]==key) {
                i++;
            }else if(a[i]>key){
                swap(a, l++, i++);
            }else{
                swap(a,h--,i);
            }
        }
        int[] range = new int[2];
        range[0]=l;
        range[1]=h;
        return range;
    }

    private static  void swap(int[] a,int l, int h){
        int temp = a[h];
        a[h] = a[l];
        a[l] = temp;
    }

    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        String line = scanner.nextLine();
        String[] numberStrs = line.split("\\s");
        int[] numbers = new int[numberStrs.length];
        for(int i=0;i<numbers.length;i++) {
            numbers[i] = Integer.valueOf(numberStrs[i]);
        }
        int k = scanner.nextInt();
        getKthElemIndex(numbers, 0, numbers.length-1, k);
        System.out.println(numbers[k-1]);
    }
}
